Code viewer
FindSeqObjectsByClass() - Startup-usable version
#Code
A custom version of Sequence::FindSeqObjectsByClass()
, but can be safely and accurately used on level startup events, such as GameMod::OnModLoaded()
.
While it's a powerful function for manipulating kismet from script, Sequence::FindSeqObjectsByClass()
can only really be relied on after gameplay has begun, such as the first Tick. Use this if your code has to run on level startup!
// Sequence::FindSeqObjectsByClass() relies on NestedSequences, which doesn't seem to be initialized at map startup (i.e. GameInfo::InitGame()). // So to work around this, I made a custom version that doesn't rely on it. Probably slower tho. function FindSeqObjectsByClass(Sequence Seq, class<SequenceObject> DesiredClass, bool bRecursive, out Array<SequenceObject> OutputObjects) { local int i; local Sequence SubSeq; for (i = 0; i < Seq.SequenceObjects.Length; i++) { if (Seq.SequenceObjects[i] != None && ClassIsChildOf(Seq.SequenceObjects[i].Class, DesiredClass)) OutputObjects.AddItem(Seq.SequenceObjects[i]); } if (bRecursive) { for (i = 0; i < Seq.SequenceObjects.Length; i++) { SubSeq = Sequence(Seq.SequenceObjects[i]); if (SubSeq != None) FindSeqObjectsByClass(SubSeq, DesiredClass, bRecursive, OutputObjects); } } }